var previewInitState = {
    previewList: [],
    newPreview: false,
    errorTip: '',
    activePreview: '',
    deletePreview: false,
    renamePreview: false,
    renameError: ''
};

export default function(state = previewInitState, action){
    switch(action.type){
        case 'GET_PREVIEW':
            return {...state, previewList:action.previewList};

        case 'NEW_PREVIEW':
            return {...state, newPreview:action.newPreview}    

        case 'ERROR_TIP':
            return {...state, errorTip:action.errorTip}   

        case 'ACTIVE_PREVIEW':
            return {...state, activePreview:action.activePreview}     

        case 'DELETE_PREVIEW':
            return {...state, deletePreview:action.deletePreview}   
            
        case 'RENAME_PREVIEW':
            return {...state, renamePreview:action.renamePreview} 

        case 'RENAME_PREVIEW_ERROR':
            return {...state, renameError:action.renameError}       

        default:
            return state;
    }
}